home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / LanguageAnalysis.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  6KB  |  220 lines

  1. /*
  2.      File:        LanguageAnalysis.h
  3.  
  4.      Contains:    Language Analysis Manager Interfaces
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __LANGUAGEANALYSIS__
  19. #define __LANGUAGEANALYSIS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __AEDATAMODEL__
  25. #include <AEDataModel.h>
  26. #endif
  27. #ifndef __AEREGISTRY__
  28. #include <AERegistry.h>
  29. #endif
  30. #ifndef __FILEMANAGERTYPES__
  31. #include <FileManagerTypes.h>
  32. #endif
  33. #ifndef __LOCALEOBJECTS__
  34. #include <LocaleObjects.h>
  35. #endif
  36. #ifndef __DICTIONARY__
  37. #include <Dictionary.h>
  38. #endif
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #if PRAGMA_IMPORT_SUPPORTED
  45. #pragma import on
  46. #endif
  47.  
  48. #if PRAGMA_ALIGN_SUPPORTED
  49. #pragma options align=power
  50. /* the following contents can only be used by compilers that support PowerPC struct alignment */
  51.  
  52. #if FOR_SYSTEM8_PREEMPTIVE
  53. #if FOR_PTR_BASED_AE
  54. typedef UInt32 LAItemOffset;
  55. typedef LocaleObjectRef LAEnvironmentLocaleObjectRef;
  56. typedef struct OpaqueLAContextRef* LAContextRef;
  57. typedef AEKeyword LAPropertyKey;
  58. typedef DescType LAPropertyType;
  59. /*
  60.     Names for Environment Locale Object Attribute Names and Values
  61. */
  62. #define kLAAnalysisClassName        "\pLAAnalysisClass"
  63. #define kLAJapaneseKanaKanjiClass    "\pKanaKanjiConversion"
  64. /* Japanese Kana-Kanji conversion*/
  65. #define kLAJapaneseTTSClass        "\pTextToSpeech"
  66. /* Japanese TTS*/
  67. #define kLAMorphemeAnalysisClass    "\pMophemeAnalysis"
  68. /* General Morpheme Analysis*/
  69. /*
  70.     Tags for Environment Properties
  71. */
  72.  
  73. enum {
  74.     keyAELAAutoLearning            = 'laal',                        /* Boolean*/
  75.     keyAELALearningDictionary    = 'lald',                        /* Some permanent file specification*/
  76.     keyAELADictionaryList        = 'ladc'                        /* AEList which has a list of dictionary informaion.*/
  77. };
  78.  
  79. /*
  80.     Tags for dictionary information
  81. */
  82.  
  83. enum {
  84.     keyAELADictionaryFile        = 'dfil',                        /* Some permanent file specification*/
  85.     keyAELADictionaryWeight        = 'dwgt',                        /* Int32*/
  86.     keyAELADictionaryID            = 'did '                        /* DictionaryID (r/o, volatile)*/
  87. };
  88.  
  89. typedef AERecord LAMorphemeBundle;
  90. typedef AERecord LAMorphemePath;
  91. typedef AERecord LAMorpheme;
  92. typedef AERecord LAHomograph;
  93.  
  94. enum {
  95.     typeLAMorphemeBundle        = 'lmfb',
  96.     typeLAMorphemePath            = 'lmfp',
  97.     typeLAMorpheme                = 'lmfn',
  98.     typeLAHomograph                = 'lmfh'
  99. };
  100.  
  101.  
  102. enum {
  103.     keyAELAMorphemeBundle        = 'lmfb',
  104.     keyAELAMorphemePath            = 'lmfp',
  105.     keyAELAMorpheme                = 'lmfn',
  106.     keyAELAHomograph            = 'lmfh'
  107. };
  108.  
  109.  
  110. enum {
  111.     kLADefaultEdge                = 0,
  112.     kLAFreeEdge                    = 1,
  113.     kLAIncompleteEdge            = 2
  114. };
  115.  
  116.  
  117. enum {
  118.     kAllMorphemes                = -1
  119. };
  120.  
  121.  
  122. enum {
  123.     kNoContext                    = 0
  124. };
  125.  
  126. typedef OptionBits LAFeedbackType;
  127.  
  128. enum {
  129.     kLAAcceptedAsIs                = 0,
  130.     kLAHomophoneSelected        = 1 << 0,
  131.     kLALocalReanalysis            = 1 << 1,
  132.     kLATransLiterate            = 1 << 2
  133. };
  134.  
  135. /*
  136.     Error Value
  137. */
  138.  
  139. enum {
  140.     laEngineNotFoundErr            = -7000,                        /* can't find the engine*/
  141.     laPropertyErr                = -7001,                        /* Error in properties*/
  142.     laPropertyNotFoundErr        = -7002,                        /* can't find the property*/
  143.     laPropertyIsReadOnlyErr        = -7003,                        /* the property is read only*/
  144.     laPropertyUnknownErr        = -7004,                        /* the property is unknown to this environment*/
  145.     laPropertyValueErr            = -7005,                        /* Invalid property value*/
  146.     laDictionaryTooManyErr        = -7006,                        /* too many dictionaries*/
  147.     laDictionaryUnknownErr        = -7007,                        /* can't use this dictionary with this environment*/
  148.     laDictionaryNotOpenedErr    = -7008,                        /* the dictionary is not opened*/
  149.     laTextOverFlowErr            = -7009,                        /* text is too long*/
  150.     laFailAnalysisErr            = -7010,                        /* analysis failed*/
  151.     laNoMoreMorphemeErr            = -7011                            /* nothing to read*/
  152. };
  153.  
  154. /*
  155.     Handling Context
  156. */
  157. extern OSStatus LAOpenContext(LAEnvironmentLocaleObjectRef environ, LAContextRef *context, OSStatus *specificErr, AERecord *which);
  158.  
  159. extern OSStatus LACloseContext(LAContextRef context);
  160.  
  161. /*
  162.     Handling Environment
  163. */
  164. extern OSStatus LAGetEnvironmentProperty(LAEnvironmentLocaleObjectRef environment, LAPropertyKey propertyKey, LAPropertyType desiredType, ByteCount maxSize, LAPropertyType *actualType, ByteCount *actualSize, LogicalAddress value);
  165.  
  166. extern OSStatus LASetEnvironmentProperty(LAEnvironmentLocaleObjectRef environment, LAPropertyKey propertyKey, LAPropertyType propertyType, ByteCount valueSize, ConstLogicalAddress value, OSStatus *specificErr);
  167.  
  168. /*
  169.     Handling dictionries
  170. */
  171. extern OSStatus LAOpenDictionary(LAEnvironmentLocaleObjectRef environ, DCMDictionaryID dictionaryID, AERecord *dictionaryProperty);
  172.  
  173. extern OSStatus LACloseDictionary(LAEnvironmentLocaleObjectRef environ, DCMDictionaryID dictionary);
  174.  
  175. extern OSStatus LAListAvailableDictionary(LAEnvironmentLocaleObjectRef environ, ItemCount maxCount, ItemCount *actualCount, DCMDictionaryID dictionaryList[]);
  176.  
  177. /*
  178.     Analyzing text
  179. */
  180. extern OSStatus LAMorphemeAnalysis(LAContextRef context, ConstTextObject text, LAMorphemePath *leadingPath, LAMorphemePath *trailingPath, ItemCount pathCount, LAMorphemeBundle *result);
  181.  
  182. extern OSStatus LAContinuousMorphemeAnalysis(LAContextRef context, ConstTextObject text, Boolean incrementalText, LAMorphemePath *leadingPath, LAMorphemePath *trailingPath, Boolean *modified);
  183.  
  184. extern OSStatus LAGetMorphemes(LAContextRef context, LAMorphemePath *result);
  185.  
  186. extern OSStatus LAShiftMorphemes(LAContextRef context, ItemCount morphemeCount, LAMorphemePath *path, ByteCount *byteCount);
  187.  
  188. extern OSStatus LAResetAnalysis(LAContextRef context);
  189.  
  190. extern OSStatus LAGetAllHomographs(LAContextRef context, const LAMorphemePath *path, LAItemOffset morphemeOffset, LAMorpheme *morpheme);
  191.  
  192. extern OSStatus LAGetRootForm(LAContextRef context, const LAMorphemePath *path, LAItemOffset morphemeOffset, LAMorphemePath *rootForm);
  193.  
  194. /*
  195.     Learning
  196. */
  197. extern OSStatus LAFeedbackPath(LAContextRef context, LAMorphemePath path, LAItemOffset startingPosition, ItemCount morphemeCount, LAFeedbackType *feedbackType, Boolean confirmed);
  198.  
  199. /*
  200.     TextObject interface
  201. */
  202. extern OSStatus LAAnnotateTextObjectWithMorpheme(ConstStr255Param analysisClass, ItemCount tagCount, DCMFieldTag *tags, TextObject text);
  203.  
  204. #endif
  205. #endif
  206.  
  207. #pragma options align=reset
  208. #endif /* PRAGMA_ALIGN_SUPPORTED */
  209.  
  210. #if PRAGMA_IMPORT_SUPPORTED
  211. #pragma import off
  212. #endif
  213.  
  214. #ifdef __cplusplus
  215. }
  216. #endif
  217.  
  218. #endif /* __LANGUAGEANALYSIS__ */
  219.  
  220.